//		Written by Don Yacktman Copyright (c) 1994 by Don Yacktman.
//				Version 1.0.  All rights reserved.
//
//		This notice may not be removed from this source code.
//
//	This program is included in the MiscKit by permission from the author
//	and its use is governed by the MiscKit license, found in the file
//	"LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
//	for a list of all applicable permissions and restrictions.
//	


#import "TreeButtonCell.h"
#import "TreeButton.h"

@implementation TreeButtonCell

- parent { return parent; }
- setParent:anObject
{	// anObject should be the parent Control object subclass
	parent = anObject;
	return self;
}

- (BOOL)trackMouse:(NXEvent *)theEvent
		inRect:(const NXRect *)cellFrame ofView:aView
{	// this traps the button being selected.
	BOOL result = [super trackMouse:theEvent inRect:cellFrame ofView:aView];
	if (result && [parent respondsTo:@selector(wasSelected:)]) {
		[parent wasSelected:self];
	}
	return result;
}

- performClick:sender
{
	[super performClick:sender];
	if ([parent respondsTo:@selector(wasSelected:)]) {
		[parent wasSelected:self];
	}
	return self;
}

@end
